package com.lcj.controller;

import com.lcj.rsp.ApiResponse;
import com.lcj.service.impl.ProfileService;
import com.lcj.vo.Profiles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api")
public class ProfileController {
    @Autowired
    private ProfileService profileService;

    @GetMapping("/profiles/{userName}")
    public ApiResponse<Profiles> getProfile(String userName) {
        Profiles profiles = profileService.getProfiles(userName);
        return ApiResponse.success(profiles);
    }
//    POST /api/profiles/:username/follow
    @PostMapping("/profiles/{userName}/follow")
    public ApiResponse<Profiles> followProfile(String userName) {
        // 实现关注逻辑
        Profiles follow = profileService.follow(userName);
        return ApiResponse.success(follow);
    }
    @DeleteMapping("/profiles/{userName}/unfollow")
    public ApiResponse<Profiles> unfollowProfile(String userName) {
        // 实现取消关注逻辑
        Profiles unfollow = profileService.unfollow(userName);
        return ApiResponse.success(unfollow);

    }
}
